package com.zl.learning.excel;

import com.zl.learning.excel.util.ExcelUtil;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

public class ExcelUtilTest {
    public static void main(String[] args) {
        List<User> list = List.of(new User("张三", "男", 11, "18955667788", "zhangsan@126.com", "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi4.qhimg.com%2Ft01dadc71c75c8d8533.jpg&refer=http%3A%2F%2Fi4.qhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1615086357&t=9a567de34bb7c624fa7cac816df4e969"));
        final Workbook wb = ExcelUtil.exportExcel(User.class, list);
        try (OutputStream out = Files.newOutputStream(Paths.get("D://2.xlsx"))) {
            wb.write(out);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
